//
//  ToutiaoMulImgModelCell.m
//  BobNews
//
//  Created by lanou3g on 16/5/5.
//  Copyright © 2016年 liu. All rights reserved.
//

#import "ToutiaoMulImgModelCell.h"
#import "UIImageView+WebCache.h"
#import "BigImageView.h"
@interface ToutiaoMulImgModelCell ()
@property (weak, nonatomic) IBOutlet UILabel *titleLable;
@property (weak, nonatomic) IBOutlet UILabel *sourceLable;
@property (weak, nonatomic) IBOutlet UILabel *replyCountLable;
@property (weak, nonatomic) IBOutlet UIImageView *imsrcView1;
@property (weak, nonatomic) IBOutlet UIImageView *imsrcView2;
@property (weak, nonatomic) IBOutlet UIImageView *imsrcView3;


@end

@implementation ToutiaoMulImgModelCell

- (void)setModel:(ToutiaoMulImgModel *)model {
    if (_model != model) {
        _model = model;
    }
}

- (void)layoutSubviews {
    self.titleLable.text = self.model.title;
    self.sourceLable.text = self.model.source;
    [self.imsrcView1 sd_setImageWithURL:[NSURL URLWithString:self.model.imgnewextra[0][@"imgsrc"]]];
    [self.imsrcView2 sd_setImageWithURL:[NSURL URLWithString:self.model.imgnewextra[1][@"imgsrc"]]];
    [self.imsrcView3 sd_setImageWithURL:[NSURL URLWithString:self.model.imgsrc]];
    
    NSString *special = self.model.specialID;
    NSString *video = self.model.videoID;
    NSString *photo = self.model.photosetID;
    NSString *tag = self.model.TAG;
    if (special) {
        self.replyCountLable.text = @"专题";
    } else if (video) {
        self.replyCountLable.text = @"视频";
    } else if (photo) {
        self.replyCountLable.text = @"图集";
    } else if (tag) {
//        self.replyCountLable.text = tag;
    } else {
        self.replyCountLable.text = [NSString stringWithFormat:@"%@跟帖",self.model.replyCount];
    }
    self.imsrcView1.userInteractionEnabled = YES;
    self.imsrcView2.userInteractionEnabled = YES;
    self.imsrcView3.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(imsrcView1Action:)];
    [self.imsrcView1 addGestureRecognizer:tap1];
    UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(imsrcView2Action:)];
    [self.imsrcView2 addGestureRecognizer:tap2];

    UITapGestureRecognizer *tap3 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(imsrcView3Action:)];
    [self.imsrcView3 addGestureRecognizer:tap3];

}
- (void)imsrcView1Action:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.imsrcView1];
}
- (void)imsrcView2Action:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.imsrcView2];
}
- (void)imsrcView3Action:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.imsrcView3];
}

+ (CGFloat)height {
    return 200;
}



@end
